// 通过
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

const int MAXN = 1e5;
int n, x[MAXN + 5], y[MAXN + 5], p[MAXN + 5], q[MAXN + 5];
LL ans = 0x7fffffffffffffff, prex[MAXN + 5], prey[MAXN + 5];

int main() {
  cin >> n;
  for (int a, b, i = 1; i <= n; ++i) {
    cin >> a >> b;
    x[i] = p[i] = a + b;
    y[i] = q[i] = a - b; // 转曼哈顿距离，且乘上 2
  }
  sort(p + 1, p + n + 1);
  sort(q + 1, q + n + 1);        // 排序
  for (int i = 1; i <= n; ++i) { // 维护前缀和
    prex[i] = prex[i - 1] + p[i];
    prey[i] = prey[i - 1] + q[i];
  }
  for (int i = 1; i <= n; ++i) {
    int posx = lower_bound(p + 1, p + n + 1, x[i]) - p;
    int posy = lower_bound(q + 1, q + n + 1, y[i]) - q;
    // 二分找到 x[i] 和 y[i] 是所有点中第几个大的
    LL sumx = (LL)posx * x[i] - prex[posx] + prex[n] - prex[posx] -
              (LL)(n - posx) * x[i];
    // 计算横坐标贡献
    LL sumy = (LL)posy * y[i] - prey[posy] + prey[n] - prey[posy] -
              (LL)(n - posy) * y[i];
    // 计算纵坐标贡献
    ans = min(ans, sumx + sumy);
  }
  cout << ans / 2 << endl;
  return 0;
}